package Crawler;

import java.io.*;
import java.util.StringTokenizer;

/**
 * 按行读取文件,并且将uid以及connum分开（不过貌似我们最后并没有需要）
 */

public class ioTest {
    public static void main(String[] args) {
        try {
            // read file content from file
            StringBuffer sb = new StringBuffer("");

            FileReader reader = new FileReader("C:/Users/TING/code/java code/Weibo/UID_CONNUM_200+.txt");
            BufferedReader br = new BufferedReader(reader);

            String uid_connum = null;

            while ((uid_connum = br.readLine()) != null) {
                sb.append(uid_connum + "/n");
                // System.out.println(uid_connum);
                StringTokenizer token = new StringTokenizer(uid_connum, ",");
                while (token.hasMoreElements()) {
                    // nextToken()打印下一个字段
                    System.out.print(token.nextToken() + "\n");
                }
            }

            br.close();
            reader.close();

//            // 将文件写入
//            FileWriter writer = new FileWriter("c://test2.txt");
//            BufferedWriter bw = new BufferedWriter(writer);
//            bw.write(sb.toString());
//
//            bw.close();
//            writer.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

